package com.exchange.controller;

import com.exchange.test.Sender;
import com.exchange.utils.result.CommonResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/***
 *                    .::::.
 *                  .::::::::.
 *                 ::::::::::: 
 *             ..:::::::::::' 
 *           '::::::::::::'
 *             .::::::::::
 *        '::::::::::::::..
 *             ..::::::::::::.
 *           ``::::::::::::::::
 *            ::::``:::::::::'        .:::.
 *           ::::'   ':::::'       .::::::::.
 *         .::::'      ::::     .:::::::'::::.
 *        .:::'       :::::  .:::::::::' ':::::.
 *       .::'        :::::.:::::::::'      ':::::.
 *      .::'         ::::::::::::::'         ``::::.
 *  ...:::           ::::::::::::'              ``::.
 * ```` ':.          ':::::::::'                  ::::..
 *                    '.:::::'                    ':'````..
 *
 * @Author liuhai
 * @Date 2021-01-07 17:09:14
 * @Description
 */
@RestController
@RefreshScope
@RequestMapping("/msg")
@Api(value = "消息管理", tags = "消息管理接口")
public class MsgController {

    @Autowired
    private Sender sender;

    @PostMapping("/sendMsg")
    public CommonResult sendMsg(@RequestParam("msg") String msg) {
        int i=1;
        while (i<100){
            sender.send(msg + i);
            //
            i++;
        }
        return CommonResult.success(msg +  "消息发送成功");
    }
}
